import {
  METAL_SELECT_LIST,
  SUPPLIER_NATURE_CLASSIFY_SELECT_LIST,
} from '@/pages/supplier/constants/common'
const hrAreaId = localStorage.userInfo ? JSON.parse(localStorage.userInfo).hrAreaId : ''

// 工商信息
const BUSINESS_INFORMATION_FIELDS = [
  { prop: 'supplierNatureClassify', label: '性质分类', required: true, type: 'select', options: SUPPLIER_NATURE_CLASSIFY_SELECT_LIST },
  { prop: 'enterpriseName', label: '企业名称', required: true, max: 100 },
  { prop: 'legalPerson', label: '法定代表人', required: true, disabled: true },
  { prop: 'regCapital', label: '注册资本（万元）', required: true, disabled: true },
  { prop: 'paidInCapital', label: '实缴资本', required: true, disabled: true },
  { prop: 'unifiedSocialCreditCode', label: '统一社会信用代码', required: true, disabled: true },
  { prop: 'establishmentDate', label: '成立日期', type: 'datetime', required: true, disabled: true },
  { prop: 'approvalDate', label: '核准日期', type: 'datetime', required: true, disabled: true },
  { prop: 'organizationCode', label: '组织机构代码', required: true, disabled: true },
  { prop: 'businessRegNumber', label: '工商注册号', required: true, disabled: true },
  { prop: 'taxpayerIdentityNumber', label: '纳税人识别号', required: true, disabled: true },
  // { prop: 'enterpriseType', label: '企业类型', type: 'select', options: QI_XIN_BAO_TYPE_NEW, required: true, disabled: true },
  { prop: 'enterpriseType', label: '企业类型', required: true, disabled: true },
  { prop: 'belongIndustry', label: '所属行业', required: true, disabled: true },
  { prop: 'belongRegion', label: '所属地区', required: true, disabled: true },
  { prop: 'regAuthority', label: '登记机关', required: true, disabled: true },
  { prop: 'registerAddress', label: '注册地址', required: true, disabled: true },
  { prop: 'businessTermStart', label: '营业期限起', disabled: true },
  { prop: 'businessTermEnd', label: '营业期限止', disabled: true },
  { prop: 'businessScope', label: '经营范围', colSpan: 24, type: 'textarea', required: true, disabled: true },
]

// 商品信息
const PRODUCT_INFORMATION_FIELDS = [
  { prop: 'mainCategoryCode', label: '主营品类代码', required: false, disabled: true },
  { prop: 'mainCategory', label: '主营品类', required: false, type: 'categorySelect' },
  { prop: 'metal', label: '是否金属', required: false, disabled: true, type: 'select', options: METAL_SELECT_LIST },
  { prop: 'manageCategory', label: '经营品类', required: false, type: 'button', buttonList: [{ label: '修改', key: 'edit' }, { label: '查看', key: 'view' }] },
  { prop: 'mainProduct', label: '主营商品', required: false, maxlength: 50 },
]

// 管理信息
const MANAGEMENT_INFORMATION_FIELDS = [
  { prop: 'supplierCode', label: '供应商代码', disabled: true },
  { prop: 'supplierName', label: '供应商名称', required: true, maxlength: 100 },
  { prop: 'gainSource', label: '供应商来源', required: false, type: 'select', filterable: true, dict: 227 },
  { prop: 'exhibitionName', label: '展会名称', maxlength: 50 },
  { prop: 'supplierType', label: '供应商类型', disabled: true, type: 'select', sysDict: 10130 },
  { prop: 'managementAreaId', label: '供应商管理区域', required: true, type: 'managementArea', hrAreaId },
  { prop: 'belongDepartment', label: '供应商归属中心', required: false, type: 'select', filterable: true, dict: 233, disabledValues: [200] },
  { prop: 'supplierClassify', label: '供应商分类', disabled: true, type: 'select', sysDict: 10138 },
  { prop: 'createUser', label: '创建人', disabled: true },
  { prop: 'createTime', label: '创建日期', disabled: true, type: 'datetime' },
]

// 合同信息
const BILLING_INFORMATION_FIELDS = [
  { prop: 'generalTaxpayer', label: '纳税人类型', required: true, type: 'select', dict: 310 },
  { prop: 'invoiceType', label: '发票类型', required: true, type: 'select', sysDict: 521 },
  { prop: 'taxBillRate1', label: '税票率1', required: true, type: 'select', sysDict: 10100 },
  { prop: 'taxBillRate2', label: '税票率2', type: 'select', sysDict: 10100 },
]

export {
  BUSINESS_INFORMATION_FIELDS,
  PRODUCT_INFORMATION_FIELDS,
  MANAGEMENT_INFORMATION_FIELDS,
  BILLING_INFORMATION_FIELDS,
}
